import React from 'react'


export default class Child extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            name: '',
            count: 0
        }
    }

    componentWillReceiveProps(props) {
        console.log(props.name + '-' + props.count);
        this.setState({
            name: props.name,
            count: props.count
        })
    }

    render() {
        return <div>
            <p>{this.state.name + '-' + this.state.count}</p>
        </div>
    }
}